//
//  YTNetManager.h
//  YiTuDriverClient
//
//  Created by 石少庸 on 2017/5/4.
//  Copyright © 2017年 Yitu. All rights reserved.
//

#import <Foundation/Foundation.h>

/// 成功回调
typedef void(^YTRequestSuccess)(id response);
/// 失败回调
typedef void(^YTRequestFailure)(NSError *error);
/// 请求进度
typedef void(^YTRequestProgress)(NSProgress *progress);

@interface YTNetManager : NSObject

#pragma mark - 网络请求

+ (instancetype)manager;

/**
 post网络请求V3
 
 @param url url，这里不需要加module参数，直接放入controller和action就行了（controller/action)
 @param parameters 参数
 @param success 成功回调
 @param fialure 失败回调
 */
- (void)postWithURL:(NSString *)url
         parameters:(NSDictionary *)parameters
            success:(YTRequestSuccess)success
            failure:(YTRequestFailure)failure;

- (void)getWithURL:(NSString *)url
           success:(YTRequestSuccess)success
           failure:(YTRequestFailure)failure;

#pragma mark - 网络状态监测


/**
 是否联网
 
 @return YES or NO
 */
+ (BOOL)isReachableNetwork;

/**
 移动网络
 
 @return YES or NO
 */
+ (BOOL)isMobileNetwork;

/**
 Wi-Fi网络
 
 @return YES or NO
 */
+ (BOOL)isWiFiNetwork;


/**
 显示网络加载菊花
 */
+ (void)networkActivityIndicatorShow;


/**
 隐藏网络加载菊花
 */
+ (void)networkActivityIndicatorDissmis;

@end
